package com.example.exception;

/**
 * 错误码常量类
 * 统一管理系统中的所有错误码
 */
public class ErrorCode {
    
    // ========== 通用错误码 ==========
    public static final String SUCCESS = "00000";
    public static final String SYSTEM_ERROR = "10000";
    public static final String PARAMETER_ERROR = "10001";
    public static final String NETWORK_ERROR = "10002";
    public static final String TIMEOUT_ERROR = "10003";
    public static final String UNKNOWN_ERROR = "10004";
    
    // ========== 用户相关错误码 ==========
    public static final String USER_NOT_FOUND = "20001";
    public static final String USER_ALREADY_EXISTS = "20002";
    public static final String USER_PASSWORD_ERROR = "20003";
    public static final String USER_DISABLED = "20004";
    public static final String USER_LOCKED = "20005";
    public static final String USER_NOT_ACTIVATED = "20006";
    public static final String USER_REGISTRATION_FAILED = "20007";
    public static final String USER_UPDATE_FAILED = "20008";
    public static final String USER_DELETE_FAILED = "20009";
    
    // ========== 认证相关错误码 ==========
    public static final String AUTH_TOKEN_INVALID = "30001";
    public static final String AUTH_TOKEN_EXPIRED = "30002";
    public static final String AUTH_TOKEN_MISSING = "30003";
    public static final String AUTH_LOGIN_FAILED = "30004";
    public static final String AUTH_LOGOUT_FAILED = "30005";
    public static final String AUTH_REFRESH_TOKEN_INVALID = "30006";
    public static final String AUTH_CAPTCHA_ERROR = "30007";
    public static final String AUTH_VERIFICATION_CODE_ERROR = "30008";
    public static final String AUTH_ACCOUNT_LOCKED = "30009";
    
    // ========== 权限相关错误码 ==========
    public static final String PERMISSION_DENIED = "40001";
    public static final String PERMISSION_NOT_FOUND = "40002";
    public static final String PERMISSION_ALREADY_EXISTS = "40003";
    public static final String PERMISSION_ASSIGNMENT_FAILED = "40004";
    public static final String ROLE_NOT_FOUND = "40005";
    public static final String ROLE_ALREADY_EXISTS = "40006";
    public static final String ROLE_ASSIGNMENT_FAILED = "40007";
    public static final String MENU_NOT_FOUND = "40008";
    public static final String MENU_ACCESS_DENIED = "40009";
    
    // ========== 数据相关错误码 ==========
    public static final String DATA_NOT_FOUND = "50001";
    public static final String DATA_ALREADY_EXISTS = "50002";
    public static final String DATA_VALIDATION_FAILED = "50003";
    public static final String DATA_SAVE_FAILED = "50004";
    public static final String DATA_UPDATE_FAILED = "50005";
    public static final String DATA_DELETE_FAILED = "50006";
    public static final String DATA_QUERY_FAILED = "50007";
    public static final String DATA_CONSTRAINT_VIOLATION = "50008";
    public static final String DATA_INTEGRITY_ERROR = "50009";
    
    // ========== 外键约束相关错误码 ==========
    public static final String FOREIGN_KEY_CONSTRAINT_VIOLATION = "50101";
    public static final String FOREIGN_KEY_DELETE_RESTRICTED = "50102";
    public static final String FOREIGN_KEY_UPDATE_RESTRICTED = "50103";
    public static final String FOREIGN_KEY_REFERENCE_NOT_FOUND = "50104";
    public static final String FOREIGN_KEY_CIRCULAR_REFERENCE = "50105";
    public static final String FOREIGN_KEY_DEPENDENCY_EXISTS = "50106";
    
    // 具体业务外键约束错误码
    public static final String USER_HAS_ROLES_CANNOT_DELETE = "50201";
    public static final String USER_HAS_BALANCE_CANNOT_DELETE = "50202";
    public static final String USER_HAS_RECHARGE_RECORDS_CANNOT_DELETE = "50203";
    public static final String USER_HAS_OPERATION_LOGS_CANNOT_DELETE = "50204";
    public static final String ROLE_HAS_USERS_CANNOT_DELETE = "50205";
    public static final String ROLE_HAS_MENUS_CANNOT_DELETE = "50206";
    public static final String ROLE_HAS_PERMISSIONS_CANNOT_DELETE = "50207";
    public static final String MENU_HAS_CHILDREN_CANNOT_DELETE = "50208";
    public static final String MENU_HAS_ROLE_BINDINGS_CANNOT_DELETE = "50209";
    public static final String PERMISSION_HAS_CHILDREN_CANNOT_DELETE = "50210";
    public static final String PERMISSION_HAS_ROLE_BINDINGS_CANNOT_DELETE = "50211";
    
    // ========== 文件相关错误码 ==========
    public static final String FILE_NOT_FOUND = "60001";
    public static final String FILE_UPLOAD_FAILED = "60002";
    public static final String FILE_DOWNLOAD_FAILED = "60003";
    public static final String FILE_DELETE_FAILED = "60004";
    public static final String FILE_SIZE_EXCEEDED = "60005";
    public static final String FILE_TYPE_NOT_SUPPORTED = "60006";
    public static final String FILE_PROCESSING_FAILED = "60007";
    
    // ========== 邮件相关错误码 ==========
    public static final String EMAIL_SEND_FAILED = "70001";
    public static final String EMAIL_CONFIG_ERROR = "70002";
    public static final String EMAIL_TEMPLATE_ERROR = "70003";
    public static final String EMAIL_VERIFICATION_FAILED = "70004";
    
    // ========== 短信相关错误码 ==========
    public static final String SMS_SEND_FAILED = "80001";
    public static final String SMS_CONFIG_ERROR = "80002";
    public static final String SMS_TEMPLATE_ERROR = "80003";
    public static final String SMS_VERIFICATION_FAILED = "80004";
    public static final String SMS_QUOTA_EXCEEDED = "80005";
    
    // ========== 聊天相关错误码 ==========
    public static final String CHAT_MESSAGE_SEND_FAILED = "90001";
    public static final String CHAT_MESSAGE_NOT_FOUND = "90002";
    public static final String CHAT_USER_NOT_ONLINE = "90003";
    public static final String CHAT_PERMISSION_DENIED = "90004";
    public static final String CHAT_WEBSOCKET_ERROR = "90005";
    
    // ========== 配置相关错误码 ==========
    public static final String CONFIG_NOT_FOUND = "A0001";
    public static final String CONFIG_UPDATE_FAILED = "A0002";
    public static final String CONFIG_VALIDATION_FAILED = "A0003";
    public static final String CONFIG_PARSE_ERROR = "A0004";
    
    // ========== 日志相关错误码 ==========
    public static final String LOG_RECORD_FAILED = "B0001";
    public static final String LOG_QUERY_FAILED = "B0002";
    public static final String LOG_DELETE_FAILED = "B0003";
    public static final String LOG_EXPORT_FAILED = "B0004";
    
    // ========== 通知相关错误码 ==========
    public static final String NOTIFICATION_SEND_FAILED = "C0001";
    public static final String NOTIFICATION_NOT_FOUND = "C0002";
    public static final String NOTIFICATION_UPDATE_FAILED = "C0003";
    
    // ========== 外部服务错误码 ==========
    public static final String EXTERNAL_SERVICE_UNAVAILABLE = "D0001";
    public static final String EXTERNAL_SERVICE_TIMEOUT = "D0002";
    public static final String EXTERNAL_SERVICE_ERROR = "D0003";
    public static final String EXTERNAL_API_RATE_LIMIT = "D0004";
    
    // ========== 缓存相关错误码 ==========
    public static final String CACHE_ERROR = "E0001";
    public static final String CACHE_KEY_NOT_FOUND = "E0002";
    public static final String CACHE_OPERATION_FAILED = "E0003";
    
    // ========== 数据库相关错误码 ==========
    public static final String DATABASE_CONNECTION_ERROR = "F0001";
    public static final String DATABASE_QUERY_ERROR = "F0002";
    public static final String DATABASE_UPDATE_ERROR = "F0003";
    public static final String DATABASE_TRANSACTION_ERROR = "F0004";
    public static final String DATABASE_CONSTRAINT_ERROR = "F0005";
    
    private ErrorCode() {
        // 私有构造函数，防止实例化
    }
}
